package cn.edu.neusoft.demo.hospital2.Service.impl;

import cn.edu.neusoft.demo.hospital2.Dao.UserDao;
import cn.edu.neusoft.demo.hospital2.Service.UserService;
import cn.edu.neusoft.demo.hospital2.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> getUserList() {
        return userDao.getUserList();
    }

    @Override
    public User getUserById(Integer userId) {
        return userDao.selectById(userId);
    }

    @Override
    public int addUser(User user) {
        return userDao.insert(user);
    }

    @Override
    public int updateUser(User user) {
        return userDao.updateById(user);
    }

    @Override
    public int deleteUserById(Integer userId) {
        return userDao.deleteById(userId);
    }
}